<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"
	import="java.util.List,Reservation.UserBean,Application.Dao.ReservationDAO,DomainData.Reservation"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<%
		UserBean currentUser = (UserBean) session
				.getAttribute("currentSessionUser");
		if (currentUser == null) {
			response.sendRedirect("Login.jsp");
			return;
		}
		int userID = currentUser.getUserID();
	%>
	<table width=800>
		<tr>
			<td><font size="3"><b> My Reservations</b> </font></td>
		</tr>
		<tr bgcolor="#D6DCFE">
			<td></td>
		</tr>
	</table>
	<table width=800>
		<tr bgcolor="#F2F2F2">
			<td>Reservation ID</td>
			<td>From</td>
			<td>To</td>
			<td>Number Of People</td>
			<td>Table ID</td>
		</tr>
		<%
			List<Reservation> rlist = ReservationDAO.getReservations(userID);
			for (int i = 0; i < rlist.size(); i++) {
				Reservation r = rlist.get(i);
				int rID = r.getReservationID();
				out.println("<tr><td>"
						+ r.getReservationID()
						+ "</td><td>"
						+ r.getFrom().toString()
						+ "</td><td>"
						+ r.getTo().toString()
						+ "</td><td>"
						+ r.getNumberOfPeople()
						+ "</td><td>"
						+ r.getTableID()
						+ "</td><td><a href='Reservation.jsp?rid='+rID></a></td></tr>");
			}
		%>
	</table>
</body>
</html>